package com.koron.css2.clientCenter.impl;

import com.koron.css2.ServerInterface;
import com.koron.css2.clientCenter.bean.UserBean;
import com.koron.css2.clientCenter.mapper.UserInfoMapper;
import com.koron.css2.serviceManage.bean.RequestBean;
import com.koron.css2.serviceManage.bean.UserInfoBean;
import com.koron.util.Constant;
import com.koron.util.JsonUtils;
import org.koron.ebs.mybatis.SessionFactory;
import org.swan.bean.MessageBean;

/**
 * 修改用户的锁定状态，1为锁定，0为未锁
 * 
 * @author zheny
 *
 */
public class UserLockFlagUpdate implements ServerInterface {

	@Override
	public MessageBean<?> exec(SessionFactory factory, UserInfoBean userInfo, RequestBean req) {

		try {
			UserInfoMapper mapper = factory.getMapper(UserInfoMapper.class);
			UserBean bean = JsonUtils.objectToPojo(req.getData(), UserBean.class);
			mapper.updateUserLockFlag(bean.getUserNo(),bean.getLockFlag());
			return MessageBean.create(Constant.MESSAGE_INT_SUCCESS, "success", void.class);
		} catch (Exception e) {
			logger.error("修改用户锁定状态失败", e);
			return MessageBean.create(Constant.MESSAGE_INT_FAIL, "修改用户锁定状态失败", void.class);
		}
	}

}
